#pragma once
#include <Rz/Object.h>
#include <Rz/Graphics/Math/Size.h>
#include "IEffect.h"
#include "IRenderTarget2D.h"
#include "IBindableResource.h"

RZ_CLASS_FWD_DECL3(Rz, Graphics, Math, Size);
RZ_CLASS_FWD_DECL3(Rz, Graphics, Render, IRenderTarget2D);
RZ_CLASS_FWD_DECL3(Rz, Graphics, Render, IEffect);

namespace Rz { namespace Graphics { namespace Render {

class GBuffer :
	public Object,
	public IDeviceResource
{
	public:
		RZ_RTTI(Rz::Graphics::Render, GBuffer);
		RZ_RTTI_IMPLEMENTS(Object, IDeviceResource);
		RZ_RTTI_END;

		GBuffer(IRenderDevice* renderDevice, const Math::Size& size);

		virtual const IRenderTarget2D* GetColorBuffer() const;
		virtual IRenderTarget2D* GetColorBuffer();

		virtual const IRenderTarget2D* GetNormalBuffer() const;
		virtual IRenderTarget2D* GetNormalBuffer();

		virtual const IRenderTarget2D* GetDepthBuffer() const;
		virtual IRenderTarget2D* GetDepthBuffer();

		virtual const IEffect* GetShader() const;
		virtual IEffect* GetShader();

	private:
		Ptr<IRenderDevice> _renderDevice;

		Ptr<IRenderTarget2D> _color;
		Ptr<IRenderTarget2D> _normal;
		Ptr<IRenderTarget2D> _depth;

		Ptr<IEffect> _gshader;

		Math::Size _size;
};

} } }
